package com.maserb.monitor.enums;

import java.util.HashMap;
import java.util.Map;

public enum SchoolNoticeTypeEnum {
    Xiao(1,"学校通知"),Ban(2,"班级通知"),Xue(3,"学习通知"),Zuo(4,"作业通知");

    private int value;
    private String name;

    SchoolNoticeTypeEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    private static Map<Integer,String> map;

    static
    {
        map = new HashMap<>();
        SchoolNoticeTypeEnum[] orgs = SchoolNoticeTypeEnum.values();
        for(SchoolNoticeTypeEnum org : orgs)
        {
            map.put(org.getValue(),org.getName());
        }
    }

    public static String getNameByValue(Integer val)
    {
        if(map.containsKey(val)){
            return map.get(val);
        }else{
            return map.get("未知");
        }

    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    public boolean equals(SchoolNoticeTypeEnum item) {
        return this.getValue() == item.getValue() && this.getName().equals(item.getValue());
    }
}
